<include file="public@header"/>
<style type="text/css">
    td{
        vertical-align: middle;
    }
</style>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="">发放课题</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="post" action="{:url('add')}">
        时间:
        <input type="text" class="form-control js-bootstrap-date" name="create_time"
               value="{$Request.param.create_time|default=''}"
               style="width: 140px;" autocomplete="off">&nbsp; &nbsp;
        班组ID:
        <input type="text" class="form-control" name="class_id" style="width: 200px;"
               value="{$Request.param.class_id|default=''}" placeholder="请输入关键字...">
        <foreach name="data_group" item="vo">
            <input type="hidden" name="vals[]" class="vals_{$vo.group_id}" value="{$vo.group_id}">
        </foreach>        
        <input type="submit" class="btn btn-primary" value="搜索"/>
       
    </form>
    <form method="post" class="js-ajax-form margin-top-20" action="{:url('TemplateGroup/sort')}">
        <table class="table table-hover table-bordered table-list">
        <div class="table-actions">
        <tbody>
            <foreach name="data_group" item="vo">
                <tr style="display: table-row;vertical-align: inherit; border-color: inherit;" class="vals_{$vo.group_id}">
                    <td>{$vo.header.name} &nbsp;ID:{$vo.header_id}</td>
                    <td>{$vo.template.name}&nbsp;ID:{$vo.template_id}</td>
                    <td>{$vo.footer.name}&nbsp;ID:{$vo.footer_id}</td>
                    <td>{$vo.category.name}</td>
                     <td>{$vo.category.parent.name}</td>
                    <td>{$vo.appuser.realName}</td>
                    <td>{$vo.create_time}</td>
                    <td>
                        <a href="javascript:rm({$vo.group_id})">移除</a>
                    </td>
                </tr>
                <br/>
            </foreach>
        </tbody>
        </table>
    </form>
    <form method="post" class="js-ajax-form margin-top-20" action="{:url('TemplateGroup/sort')}">
        <div class="table-actions">
           <button class="btn btn-primary btn-sm js-ajax-submit" type="submit" data-action="{:url('toAdd')}" data-subcheck="true">发送模板</button>
        </div>
        <foreach name="data_group" item="vo">
            <input type="hidden" name="vals[]" class="vals_{$vo.group_id}" value="{$vo.group_id}">
        </foreach>  

        <table class="table table-hover table-bordered table-list">
         
            <thead>
            <tr>
                <th width="16"><label><input type="checkbox" class="js-check-all" data-direction="x"
                                             data-checklist="js-check-x"></label></th>
                <th width="100">班组ID</th>
                <th>班组名称</th>
                <th>学员数量</th>
                <th>创建人</th>
                <th>创建日期</th>
            </tr>
            </thead>
            <tbody>
            <foreach name="data" item="vo">
                <tr>
                    <td><input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]" value="{$vo.class_id}"></td>
                    <td>{$vo.class_id}</td>
                    <td>{$vo.classs.class_name}</td>
                    <td>{$vo.count}</td>
                    <td>{$vo.appuser.realName}</td>
                    <td>{$vo.classs.create_time}</td>
                </tr>
            </foreach>
            </tbody>
            <tfoot>
            <tr>
                <th width="16"><label><input type="checkbox" class="js-check-all" data-direction="x"
                                             data-checklist="js-check-x"></label></th>
                <th width="50">班组ID</th>
                <th>班组名称</th>
                <th>学员数量</th>
                <th>创建人</th>
  
                <th>创建日期</th>
            </tr>
            </tfoot>
        
        </table>
         <ul class="pagination">{$page|default=''}</ul>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    function rm(group_id){
        var res = confirm("确认要移除么");
        if(res == true){
            $('.vals_'+group_id).remove()
        }
    }

    $('.add').click(function(){
        var vals = [];
        $('input:checkbox:checked').each(function (index, item) {
            var value = $(this).val();
            if(value != 'on'){
                vals.push(value);
            }
        });

        vals = vals.join(',');
        if (vals == '') {
            alert('请选中套件');return false;
        }
        window.location.href = 'http://'+window.location.host+'/teacher/record/add?vals='+vals;
    });
</script>
</body>
</html>